package demo.ejs.result;

public class MyDTO {
	String id;
	String name;
	double price;
	String customer;
	long amount;
	
	public MyDTO() {
		super();
	}
	public MyDTO(String id,String name, double price, String customer, long amount) {
		super();
		this.id=id;
		this.name = name;
		this.price = price;
		this.customer = customer;
		this.amount = amount;
	}
	
	public String toXMLString() {
		StringBuffer buffer=new  StringBuffer();
		buffer.append("<I id='" + id + "' CanDelete='0'>");
		buffer.append("<U N='A' V='" + name + "' />");
		buffer.append("<U N='B' V='" + price + "' />");
		buffer.append("<U N='C' V='" + customer + "' />");
		buffer.append("<U N='D' V='" + amount + "' />");
		buffer.append("</I>");
		return buffer.toString();
	}
	public String toJSONString() {
		StringBuffer buffer=new  StringBuffer();
		buffer.append("{");
		buffer.append("\"id\":\""+id+"\",");
		buffer.append("\"CanDelete\":\""+0+"\",");
		buffer.append("\"A\":\""+name+"\",");
		buffer.append("\"B\":\""+price+"\",");
		buffer.append("\"C\":\""+customer+"\",");
		buffer.append("\"D\":\""+amount+"\"");
		buffer.append("}");
		return buffer.toString();
	}
	
	public static MyDTO fromXMLString(String xmlString) {

		return null;
	}
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public double getPrice() {
		return price;
	}
	public void setPrice(double price) {
		this.price = price;
	}
	public String getCustomer() {
		return customer;
	}
	public void setCustomer(String customer) {
		this.customer = customer;
	}
	public long getAmount() {
		return amount;
	}
	public void setAmount(long amount) {
		this.amount = amount;
	}
	
}
